import React,{Component} from "react";
import Header from "./header/Header";
import List from "./list/List";
import './commentindex.scss'
class Comment2 extends Component {
  state = { 
    list:[
      {
        title:'jack',
        content: ' 沙发！！！'
      },
      {
        title:'rose',
        content: ' 板凳~'
      },
      {
        title:'tom',
        content: ' 楼主好人'
      }
    ]
   }
   update=(data)=>{
      const list = [...this.state.list]
      console.log(1,list);
      console.log(3,this.state.list);
      list.push(data)
      this.setState({
        list
      })
      console.log(2,this.state.list);
   }
  render() { 
    return (
      <div className="warpper">
        <h3>评论</h3>
        <Header update={this.update}/>
        <List list={this.state.list}/>
      </div>
    );
  }
}
export default Comment2;